package com.hxzy.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hxzy.common.core.domain.entity.SysUser;
import com.hxzy.system.domain.dto.SysUserSearchDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 后台用户
 */
@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {

    /**
     *  spring security登录，根据用户查询用户信息
     * @param userName
     * @return
     */
    SysUser selectUserByUserName(String userName);

    IPage<SysUser> selectUserList(IPage<SysUser> page, @Param("dto") SysUserSearchDTO sysUserSearchDTO);

    /**
     * 更改用户状态
     *
     * @param sysUser
     */
    int changeStatus(SysUser sysUser);

    /**
     * 重置密码
     * @param sysUser
     * @return
     */
    int restPwd(SysUser sysUser);

    /**
     * 根据用户ID查询
     * @param userId
     * @return
     */
    SysUser selectUserById(Long userId);


    /**
     * 根据id修改用户信息
     * @param sysUser
     * @return
     */
    int updateUserById(SysUser sysUser);

    int insertSysUser(SysUser sysUser);
}
